function pobierz(id)
{
  if(id != 1 && id != 2){
    alert("Nieprawidłowy numer zestawu danych.");
    return;
  }
  url = "http://localhost/dane.php?zestaw=1" + id;
  startGETRequest(url, onComplete, onEnd);
}

function odczytajDane(responseXML)
{
  var mainNode = responseXML.documentElement;
  var nodes = mainNode.getElementsByTagName("imie");
  str = "";
  for(i = 0; i < nodes.length; i++){
    if(nodes[i].nodeType == 1){
      str += nodes[i].firstChild.nodeValue;
      str += "<br>";
    }
  }
  str = "Odczytane imiona:<br>" + str;
  var div = document.getElementById("dataDiv");
  div.innerHTML = str;
}

function onComplete(responseText, responseXML)
{
  if(!responseXML || !responseXML.documentElement){
    alert(responseText);
  }
  else if(responseXML.documentElement.nodeName == "parsererror"){
    alert(responseText);
  }
  else{
    odczytajDane(responseXML);
  }
}

function onEnd()
{
}
